package com.abigdreamer.im.server.DB.dao;

import java.util.HashMap;
import java.util.Map;

import com.abigdreamer.im.server.log.EIMLogger;
import com.abigdreamer.im.server.module.vo.MsgUser;

/**
 * 
 */
public class UserDao extends BaseDao implements IDAO {

	private static Map<String, MsgUser> allUserMap = new HashMap<String, MsgUser>();

	public Map<String, MsgUser> getAllUser() {
		EIMLogger.INFO("开始 初始 所有用户信息列表！");
		for (int i = 0; i < 100; i++) {
			MsgUser user = new MsgUser();
			user.setUserID(Integer.toString(i + 80000));
			user.setAttribute("headImage", Integer.toString((i + 1) % 100));
			user.setPassWord(user.getUserID());
			user.setUserName(Name.getUserName(i));
			user.setPersonWord(Name.userNames[i][0] + "," + Name.userNames[i][2] + "...");
			EIMLogger.INFO(user);
			allUserMap.put(user.getUserID(), user);
		}

		MsgUser user = new MsgUser();
		user.setUserID("darkness");
		user.setAttribute("headImage", "darkness");
		user.setPassWord("darkness");
		user.setUserName("许多海");
		user.setPersonWord("离开，是我唯一能做的选择，再见了...");
		EIMLogger.INFO(user);
		allUserMap.put(user.getUserID(), user);

		EIMLogger.INFO("所有用户信息列表 初始完成！");
		return allUserMap;
	}

	public MsgUser getUserByID(String userID) {
		return allUserMap.get(userID);
	}
}
